package chapter06

/**
  * create by undeRdoG on  2021-06-02  11:20
  * 凡心所向，素履以往，生如逆旅，一苇以航。
  */
object Test09_AbstractClass {

  def main(args: Array[String]): Unit = {
    val student = new Student9

    student.eat
  }
}


abstract class Person9{

  // 定义非抽象属性
  val name: String = "Person"

  // 定义抽象属性
  var age: Int

  // 非抽象方法
  def eat ={
    println("person eat")
  }

  // 抽象方法
  def sleep(): Unit
}


class Student9 extends Person9{

  override var age: Int = _

  override def sleep(): Unit = {
    println("student sleep")
  }

  // 重写非抽象属性和方法

  override val name: String = "student"

  override def eat ={
    super.eat
    println("student eat")
  }


}